﻿namespace MultipleMonitorVideo.ViewModels
{
    using System.Linq;
    using System.Windows;
    using System.Windows.Input;
    using Screen = System.Windows.Forms.Screen;

    public class DiagnosticsControlViewModel : ViewModel
    {
        public DiagnosticsControlViewModel()
        {
            this.IdentifyMonitorsCommand = new ActionCommand(this.IdentifyMonitors, () => true);
        }

        public ICommand IdentifyMonitorsCommand
        {
            get;
            private set;
        }

        private void IdentifyMonitors()
        {
            Screen[] screens = Screen.AllScreens;
            string screensInfo = "Screens:";
            screensInfo = screens.Select(screen => screen.ToString())
                .Aggregate(screensInfo, (current, screenInfo) => current + "\n\n" + screenInfo);

            string messageBoxText = screensInfo;
            const string caption = "Identify Monitors";
            const MessageBoxButton button = MessageBoxButton.OK;
            const MessageBoxImage icon = MessageBoxImage.Information;

            MessageBox.Show(messageBoxText, caption, button, icon);
        }
    }
}
